﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthorityManagement.aspx.cs" Inherits="AnalyseCRM.SystemSet.AuthorityManagement" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>证券行业分析型客户关系管理之系统管理权限管理</title>
     <link href="../Styles/index.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/management.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Scripts/Tab.js"></script>
    <script type="text/javascript" src="../Scripts/Markettab.js"></script>
    <script type="text/javascript" src="../Scripts/Common.js"></script>
    <!-- 下拉菜单美化 -->
    <script type="text/javascript" src="../Scripts/jquery-ui-1.9.1.custom/js/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="../Scripts/divselect.js"></script>
    <script type="text/javascript">
        $(function () {
            $.divselect("#divselect", "#inputselect");
            var hh = document.documentElement.clientHeight;
            var tophh = $("#top1").height() + $("#top2").height()
                        + $("#bottom1").height() + $("#tags").height() + 10;
            $("#tagContent").height(hh - tophh);
            SearchQuery();
        });

        /*================================保存菜单权限===============================================*/
        function saveauthority() {
            $("#divauthority input[type='text']").each(function () {
                if ($(this).val() == "") {
                    alert("请检查是否没有输入权限信息！");
                    return false;
                }
            });
            var pValue = $("#authorityname").val() + '|' + $("#authorityurl").val();
            jQuery.ajax({
                type: "post",
                url: "/InteractiveData/AuthorityManagementAjax.aspx",
                data: "paramvalue=" + escape(pValue) + "&paramtype=insertnewauthority",
                success: function (message) {
                    if (message == "SUCCESS") {
                        alert("保存权限成功！");
                        SearchQuery();
                    }
                    else {
                        alert("保存权限时发生异常！");
                    }
                },
                error: function () {
                    //$("#divpgtsh").html("连接服务是发生异常！");
                    alert("连接服务是发生异常！");
                }
            });

        }  // end of saveauthority

        function SearchQuery(cPage, pSize) {
            if (!arguments[0]) cPage = _cPage;
            if (!arguments[1]) pSize = _pSize;

            var foundstr = cPage + '|' + pSize;
            jQuery.ajax({
                type: "post",
                url: "/InteractiveData/AuthorityManagementAjax.aspx",
                data: "paramvalue=" + escape(foundstr) + "&paramtype=getAllauthoritys",
                success: function (message) {
                    if (message != "error") {
                        var arr = message.split("$");
                        BindQueryList(arr[0]);
                        //SetPager(cPage, arr[1], "#pager_container", pSize);
                    }
                    else {
                        alert("查询时发生异常！");
                    }
                },
                error: function () {
                    //$("#divpgtsh").html("连接服务是发生异常！");
                    alert("连接服务是发生异常！");
                }
            });
        } // end of SearchQuery 

        // 绑定查询记录
        function BindQueryList(message) {
            var oHtml = "";
            if (message == "none") { $("#search_result").html("<tr><td colspan=3>未查询到相关记录！</td></tr>"); return; }
            var list = eval("(" + message + ")").AuthorityMana;
            for (var i = 0; i < list.length; i++) {
                var data = list[i];
                oHtml += "<tr>";
                oHtml += "<td><input name=\"ckb_item\" id=\"ckb_item_" + data.authorityno
                       + "\" type=\"checkbox\" value=\"" + data.authorityno
                       + "\" onclick=\"resetautoclick('" + data.authorityno + "');\"/></td>";
                oHtml += "<td>" + data.authorityno + "</td>";
                oHtml += "<td>" + data.authorityname + "</td>";
                oHtml += "<td>" + data.url + "</td>";
                //oHtml += "<td>" + data.nodeid + "</td>";
                //oHtml += "<td>" + data.pnodeid + "</td>";
                oHtml += "</tr>";
            }
            jQuery("#search_result").html(oHtml);
        }

        function resetautoclick(auth) {
            if ($("#ckb_item_" + auth).attr("checked") == "checked") {
                $("#search_result input[type='checkbox']").each(function () {
                    $(this).attr("checked", false);
                    $("#ckb_item_" + auth).attr("checked", true);
                });
            }
        }
        /*===================================删除权限=============================================*/
        function deleteauthority() {
            var user = $("#search_result input[type='checkbox']:checked").val();
            if ((user == "") | (user == null)) {
                alert("请选择要删除的权限！");
                return false;
            }
            if (confirm("确定要删除权限信息？")) {
                jQuery.ajax({
                    type: "POST",
                    url: "/InteractiveData/AuthorityManagementAjax.aspx",
                    data: "paramvalue=" + escape(user) + "&paramtype=deleteauthority",
                    cache: false,
                    success: function (message) {
                        if (message == "SUCCESS") {
                            alert("用户删除成功！");
                            SearchQuery();
                        }
                        else {
                            alert("删除用户时发生异常!");
                        }
                    },
                    error: function () {
                        alert("服务器忙！");
                    }
                });
            }
        }
    </script>

    <!-- 下拉菜单美化end -->
    <!-- dd menu -->
    <script type="text/javascript">
    <!--
        var timeout = 500;
        var closetimer = 0;
        var ddmenuitem = 0;

        // open hidden layer
        function mopen(id) {
            // cancel close timer
            mcancelclosetime();

            // close old layer
            if (ddmenuitem) ddmenuitem.style.visibility = 'hidden';

            // get new layer and show it
            ddmenuitem = document.getElementById(id);
            ddmenuitem.style.visibility = 'visible';

        }
        // close showed layer
        function mclose() {
            if (ddmenuitem) ddmenuitem.style.visibility = 'hidden';
        }

        // go close timer
        function mclosetime() {
            closetimer = window.setTimeout(mclose, timeout);
        }

        // cancel close timer
        function mcancelclosetime() {
            if (closetimer) {
                window.clearTimeout(closetimer);
                closetimer = null;
            }
        }

        // close layer when click-out
        document.onclick = mclose;

        function closeapp() {
            window.opener = null;
            window.open("", "_self");
            window.close();
        }
        function relogon() {
            document.location = '/Logon.aspx';
        }
    // -->
    </script>

</head>
<body>
       <form id="form1" runat="server">
       <div id="top1" class="indextop">
           <div class="indextopleft">
               <img alt="" src="../images/logo_03.png" width="44" height="44" /><a>证券行业分析型客户关系管理</a></div>
           <div class="indextopright">
               <ul>
                   <li class="exit"><a href="javascript:void(0);" onclick="javascript:relogon();">退出</a></li>
                   <li class="admin">admin</li>
               </ul>
           </div>
       </div>
       <div id="top2">
           <ul id="sddm">
               <li><a class="yonghu" href="UserManagement.aspx">用户管理</a></li>
               <li><a class="role" href="RoleManagement.aspx">角色管理</a></li><%-- onmouseover="mopen('m15')" onmouseout="mclosetime()"--%>
               <li><a class="competence" href="AuthorityManagement.aspx">权限管理</a></li><%-- onmouseover="mopen('m16')" onmouseout="mclosetime()"--%>
               <li class="meunxu"></li>
               <li><a class="xitong" href="ParameterManagement.aspx">参数配置</a></li><%-- onmouseover="mopen('m17')" onmouseout="mclosetime()"--%>
               <li><a class="journal" href="JournalManagement.aspx">日志管理</a></li><%-- onmouseover="mopen('m18')" onmouseout="mclosetime()"--%>
           </ul>
       </div>
       <div class="clear">
       </div>
       <div id="con">
           <ul id="tags">
               <li class="selectTag"><a onclick="selectTagsys('tagContent0',this)" href="javascript:void(0)">
                   新增权限</a> </li>
               <li><a onclick="selectTagsys('tagContent1',this)" href="javascript:void(0)">权限列表</a>
               </li>
           </ul>
           <div id="tagContent">
               <div class="tagContent selectTag" id="tagContent0">
                   <div class="toplist">
                       <ul>
                           <li><a><strong>您当前所在的位置：</strong>系统管理 > 权限管理 > <strong>新增权限</strong></a></li>
                       </ul>
                   </div>
                   <div style="clear: both">
                   </div>
                   <div class="wrapper">
                       <!--风格一，sharp color1-->
                       <div class="graysharp color3">
                           <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
                           <div class="content" id="by1">
                               <div class="graycontent-top">
                               </div>
                               <div style="clear: both">
                               </div>
                               <div class="managementbox">
                                   <div id="divauthority" class="managementboxleft">
                                       <table class="managementbox_table">
                                           <%--<tr>
                                               <td class="Even">
                                                   权限编号：
                                               </td>
                                               <td class="odd">
                                                   <input id="authorityno" name="input" type="text" class="tableinput" />
                                                   <label style="color: Red;">
                                                       *</label>
                                               </td>
                                           </tr>--%>
                                           <tr>
                                               <td class="Even">
                                                   权限名称：
                                               </td>
                                               <td class="odd">
                                                   <input id="authorityname" name="input" type="text" class="tableinput" />
                                                   <label style="color: Red;">
                                                       *</label>
                                               </td>
                                           </tr> 
                                           <tr>
                                               <td class="Even">
                                                   权限地址(URL)：
                                               </td>
                                               <td class="odd">
                                                   <input id="authorityurl" name="input" type="text" class="tableinput" />
                                                   <label style="color: Red;">*</label>
                                               </td>
                                           </tr> 
                                       </table>
                                   </div>
                                   <div class="managementboxright">
                                   </div>
                                   <div style="clear: both">
                                   </div>
                                   <span>
                                       <input class="managementinput" name="" 
                                              type="button" value="保 存" onclick="javascript:saveauthority();" /></span>
                               </div>
                           </div>
                           <b class="b5"></b><b class="b6"></b><b class="b7"></b><b class="b8"></b>
                       </div>
                       <div style="clear: both">
                       </div>
                   </div>
               </div>
               <div class="tagContent" id="tagContent1">
                   <div class="toplist">
                       <ul>
                           <li><a><strong>您当前所在的位置：</strong>系统管理 > 权限管理 > <strong>权限列表</strong></a></li>
                       </ul>
                   </div>
                   <div style="clear: both">
                   </div>
                   <div class="wrapper">
                       <div class="graysharp color3">
                           <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
                           <div class="content" id="by2">
                               <div class="graycontent-top">
                               </div>
                               <div style="clear: both">
                               </div>
                               <div class="tablebox">
                                   <table class="tabler" id="hacker" cellspacing="0" style="width:60%;">
                                       <tr class="trbj">
                                           <td class="DmpData1"></td>
                                           <td class="DmpData1">权限(菜单)编号</td>
                                           <td class="DmpData1">权限名称</td>     
                                           <td class="DmpData1">权限地址</td>                                                                                 
                                       </tr>     
                                       <tbody id="search_result">
                                       </tbody>                                  
                                   </table>
                                   <div class="tablebottom">
                                       <input id="delauthority" class="managementinput0" name="" 
                                              onclick="javascript:deleteauthority();" type="button" value="删 除" />
                                   </div>
                               </div>
                           </div>
                           <b class="b5"></b><b class="b6"></b><b class="b7"></b><b class="b8"></b>
                       </div>
                       <div style="clear: both">
                       </div>
                   </div>
               </div>
           </div>
       </div>
       <div style="clear: both">
       </div>
       <div id="bottom1" class="foot">
           <a>版权所有：深圳华策略科技有限公司</a></div>
    </form>
</body>
</html>
